import request from "@/utils/request";

const BASE_URL = "/admin-api/admin";

class AdminAPI {
  static getAdminList(queryParams: any) {
    return request<any, any>({
      url: `${BASE_URL}/list`,
      method: "get",
      params: queryParams,
    });
  }

  static updateAdmin(data: any) {
    return request<any, any>({
      url: `${BASE_URL}/update`,
      method: "post",
      data,
    });
  }

  static deleteAdmin(id: number) {
    return request<any, any>({
      url: `${BASE_URL}/delete/${id}`,
      method: "post",
    });
  }

  static adminUpdateRole(data: any) {
    return request<any, any>({
      url: `${BASE_URL}/role/update`,
      method: "post",
      data,
    });
  }

  static getAdminRole(adminId: number) {
    return request<any, any>({
      url: `${BASE_URL}/role/${adminId}`,
      method: "get",
    });
  }
}

export default AdminAPI;
